# Definition for a binary tree node.
# class TreeNode:
#     def __init__(self, val=0, left=None, right=None):
#         self.val = val
#         self.left = left
#         self.right = right
class Solution:
    def inorderTraversal(self, root):
        result = []

        def inorder(node):
            if not node:
                return
            # 先左
            inorder(node.left)
            # 再中
            result.append(node.val)
            # 最后右
            inorder(node.right)
        
        inorder(root)

        return result
    
# 思路：
# 先递归遍历左子树；
# 访问根节点；
# 再递归遍历右子树。